package com.example.controller;

import com.example.entity.Emp;
import com.example.service.impl.EmpServiceImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/emp")
public class EmpController {

    @Resource
    EmpServiceImpl empService;

    @GetMapping("/findById")
    Emp findById(String id) {
        return empService.findById(id);
    }

    @GetMapping("/findAll")
    List<Emp> findAll() {
        return empService.findAll();
    }

    @PostMapping("/save")
    void save(Emp Emp) {
        empService.save(Emp);
    }

    @PostMapping("/update")
    void update(Emp Emp) {
        empService.update(Emp);
    }

    @PostMapping("/delete")
    void delete(String id) {
        empService.delete(id);
    }

}
